package com.ehome.poct.core.controller;

import com.ehome.poct.core.api.dto.PriceProfitResultDTO;
import com.ehome.poct.core.api.dto.order.TestStripPriceProfitSchemeDTO;
import com.ehome.poct.core.api.dto.report.PriceProfitDTO;
import com.ehome.poct.core.api.dto.report.ProfitDTO;
import com.ehome.poct.core.api.qry.StripPriceProfitQry;
import com.ehome.poct.core.api.virtual.TestStripPriceProfitSchemeService;
import com.ehome.poct.core.api.virtual.TestStripPriceProfitService;
import com.ehome.poct.core.api.vo.order.TestStripPriceProfitSchemeVO;
import com.ehome.web.annotation.RequestLog;
import com.ehome.web.controller.AbstractBaseController;
import com.ehome.web.entity.ResponseWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 检测价格方案表新增地总也需要copy一份选定的省总价格方案控制器
 *
 * @author ehome
 * @Date 2022-06-29 14:57
 */
@Slf4j
@Api(tags = "检测价格方案表新增地总也需要copy一份选定的省总价格方案")
@RestController
@RequestMapping("/profitScheme")
public class TestStripPriceProfitSchemeController extends AbstractBaseController<TestStripPriceProfitSchemeVO, TestStripPriceProfitSchemeDTO> {

    @Autowired
    TestStripPriceProfitSchemeService testStripPriceProfitSchemeService;
    @Autowired
    TestStripPriceProfitService testStripPriceProfitService;

    @ApiOperation("价格方案新增")
    @PostMapping("/addProfit")
    public ResponseWrapper<PriceProfitResultDTO> addProfit(@RequestBody PriceProfitDTO dto){
       return ResponseWrapper.ok(testStripPriceProfitSchemeService.addProfit(dto));
    }

    @ApiOperation("根据价格方案priceProfitSchemeId获取详情")
    @GetMapping("/info/{priceProfitSchemeId}")
    public ResponseWrapper<PriceProfitDTO> getProfit(@PathVariable(value = "priceProfitSchemeId") Long priceProfitSchemeId){
        return  ResponseWrapper.ok(testStripPriceProfitSchemeService.getInfoById(priceProfitSchemeId));
    }

    @ApiOperation("根据价格方案诊所信息获取详情")
    @GetMapping("/profitService")
    @RequestLog
    public List<ProfitDTO> getProfitService(StripPriceProfitQry qry){
        return testStripPriceProfitSchemeService.getProfitService(qry);
    }
}
